#pragma once


#include <QObject>
#include <QGraphicsItem>
#include <QGraphicsView>

 class BPointItem : public   QGraphicsObject
{
public:
    BPointItem(QGraphicsItem* parent, QPointF p)
        :QGraphicsObject(parent)
    {
        this->setPos(p);
        this->setFlags(QGraphicsItem::ItemIsSelectable |
                       QGraphicsItem::ItemIsMovable |
                       QGraphicsItem::ItemIsFocusable);
        this->setCursor(Qt::SizeAllCursor);
    }
protected:

    virtual QRectF boundingRect() const override
    {
        return QRectF(-10, -10, 20, 20);
    }
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
    {
        Q_UNUSED(option);
        Q_UNUSED(widget);
        // 设置画笔
        QPen pen;
        pen.setColor(Qt::blue);
        pen.setStyle(Qt::SolidLine);
        painter->setPen(pen);

        QBrush brush;
        brush.setColor(Qt::blue);
        brush.setStyle(Qt::BrushStyle::SolidPattern);
        painter->setBrush(brush);
        painter->drawEllipse(QRectF(-10, -10, 20, 20));
    }
};


